package lanQiaoBei.数学知识.容斥原理;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//https://blog.csdn.net/weixin_43972154/article/details/121795274 能被整除的数
public class P1 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=20;
       static int p[]=new int[N],n,m;
       
       public static void main(String[] args) throws IOException {
    	      String[]ss=br.readLine().split(" ");
		      n=Integer.parseInt(ss[0]);m=Integer.parseInt(ss[1]);
		      ss=br.readLine().split(" ");
		      for(int i=0;i<m;i++)
		    	  p[i]=Integer.parseInt(ss[i]);
		      
		      int res=0;
		      for(int i=1;i<(1<<m);i++){
		    	  long t=1;
		    	  int cnt=0;
		    	  for(int j=0;j<m;j++){
		    		  if((i>>j&1)==1){
		    			  t*=p[j];
		    			  if(t>n)break;
		    			  cnt++; 
		    		  }
		    	  }
		    	  if(cnt%2==0)res-=n/t;
		    	  else res+=n/t;
		      }
		      System.out.print(res);
	}
}
